﻿
    <div>
        <table cellpadding="0" border="0" cellspacing="0" class="edittable">
            <tbody>
                            <tr>
                            <td align="right">原密码：</td><td align="left"><input type="password" name="oldpwd" id="txtoldpwd" class="login-text" /></td>
                            </tr>
                            <tr>
                            <td align="right">新密码：</td><td align="left"><input type="password" name="newpwd" id="txtnewpwd" class="login-text" /></td>
                            </tr> 
            </tbody>
        </table>
    </div>
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/messages_cn.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.metadata.js")" type="text/javascript"></script>
    <script type="text/javascript">
        //var CurID =  <%=CurID %>;
        var Validator = null;
        $(function () {
            //$.metadata.setType("attr", "validate");
            //deafultValidate($("#form1"));
            //Validator = $("#form1").validate();
        });

        function f_success() {
            $(document).ready(function () {
                $.ligerDialog.confirm("是否继续编辑", "保存成功", function (ok) {
                    $.ligerDialog.closeWaitting();
                    parent.window.frames["mainframe"].f_reload();
                    if (!ok) {
                        parent.window.frames["mainframe"].f_closeWindow();
                    }
                });
            });
        }
        function f_error(message) {
            $(document).ready(function () {
                $.ligerDialog.error(message);
            });
        }
        function f_save() {
            var txtoldpwd = $("#txtoldpwd").val();
            var txtnewpwd = $("#txtnewpwd").val();
            //var userid=@ViewData["userid"].ToString();// 
            $.ajax({
                type: 'post', cache: false, dataType: 'json',
                url: '/Home/ModifyPwd',
                data: [
                                { name: 'oldpwd', value: txtoldpwd },
                                { name: 'newpwd', value: txtnewpwd }
                            ],
                //1:更新成功,2:原密码错误,3:更新失败        
                success: function (result) {
                    if (result == "2") {
                        $.ligerDialog.alert('原密码错误!');
                        $("#txtoldpwd").focus();
                    } else if (result == "3") {
                        $.ligerDialog.alert('更新失败 !');
                        $("#txtnewpwd").focus();
                    }
                    else {
                       $.ligerDialog.alert('修改成功 !');
                    }
                }
            });
        } 
    </script>
     <style type="text/css">
        .edittable .editcellmessage,.edittable .editcellverify,.edittable .editcell{ padding:4px;line-height:23px;}
        .edittable .editcellmessage{ padding-left:20px;} 
        body { font-size:12px; background:white;}
    </style>
